/*
 * Copyright 2016 Wealth Inc. All rights reserved.
 */
 package com.wealth.commodity.entity;


import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wealth.merchant.entity.Activity;
import com.wealth.merchant.entity.Merchant;

@Entity
@Table(name = "commodity_goods")
public class Goods implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	private Long id;
	private String name;
	private String title;
	private String content;
	private String picurl;
	private Double price;
	private Double originalPrice;
	private Double promotionPrice;
	private Double discount;
	private Integer remain;
	private Integer sales;
	private Integer status;
	private Date createTime;
	private Category category;
	private Merchant merchant;
	private Activity activity = new Activity();
	private GoodsVirtual goodsVirtual = new GoodsVirtual();
	private List<GoodsPic> goodsPicList = new ArrayList<GoodsPic>();
	
	private Integer isDiscount;
	private Integer isInventory;
	private Integer isFullcut;
	private Integer isVirtual;
	private Integer isCheap;
	private Integer limitType;//限制类型  0=无    1=限时抢   2=限量抢
	private Integer isPurRestrictions;//是否限购
	
	

	private Integer purRestrictionsNum;//限购数量
	
	
	/* ---------------- method ----------------*/
	
	public Goods(){
	}

	public Goods(Long id){
		this.id = id;
	}

	/* ---------------- getter/setter ----------------*/
	
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	
	public void setId(Long id) {
		this.id = id;
	}
	
	@Column(name = "discount")
	public Double getDiscount() {
		return discount;
	}
	
	public void setDiscount(Double discount) {
		this.discount = discount;
	}
	
	@Column(name = "name")
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	@Column(name = "title")
	public String getTitle() {
		return title;
	}
	
	public void setTitle(String title) {
		this.title = title;
	}
	
	@Column(name = "content")
	public String getContent() {
		return content;
	}
	
	public void setContent(String content) {
		this.content = content;
	}
	
	@Column(name = "picurl")
	public String getPicurl() {
		return picurl;
	}
	
	public void setPicurl(String picurl) {
		this.picurl = picurl;
	}
	
	@Column(name = "price")
	public Double getPrice() {
		return price;
	}
	
	public void setPrice(Double price) {
		this.price = price;
	}
	
	@Column(name = "original_price")
	public Double getOriginalPrice() {
		return originalPrice;
	}
	
	public void setOriginalPrice(Double originalPrice) {
		this.originalPrice = originalPrice;
	}
	
	@Column(name = "promotion_price")
	public Double getPromotionPrice() {
		return promotionPrice;
	}
	
	public void setPromotionPrice(Double promotionPrice) {
		this.promotionPrice = promotionPrice;
	}
	
	@Column(name = "remain")
	public Integer getRemain() {
		return remain;
	}
	
	public void setRemain(Integer remain) {
		this.remain = remain;
	}
	
	@Column(name = "sales")
	public Integer getSales() {
		return sales;
	}
	
	public void setSales(Integer sales) {
		this.sales = sales;
	}
	
	@Column(name = "status")
	public Integer getStatus() {
		return status;
	}
	
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	@Column(name = "create_time")
	public Date getCreateTime() {
		return createTime;
	}
	
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@ManyToOne
	@JoinColumn(name = "category_id")
	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}
	
	@ManyToOne
	@JoinColumn(name = "merchant_id")
	public Merchant getMerchant() {
		return merchant;
	}

	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}
	
	@ManyToOne
	@JoinColumn(name = "activity_id")
	public Activity getActivity() {
		return activity;
	}

	public void setActivity(Activity activity) {
		this.activity = activity;
	}
	
	@OneToOne
	@JoinColumn(name="goods_virtual_id")
	public GoodsVirtual getGoodsVirtual() {
		return goodsVirtual;
	}

	public void setGoodsVirtual(GoodsVirtual goodsVirtual) {
		this.goodsVirtual = goodsVirtual;
	}

	@JsonIgnore
	@OneToMany(mappedBy = "goods")
	public List<GoodsPic> getGoodsPicList() {
		return goodsPicList;
	}

	public void setGoodsPicList(List<GoodsPic> goodsPicList) {
		this.goodsPicList = goodsPicList;
	}
	
	@Column(name="is_virtual")
	public Integer getIsVirtual() {
		return isVirtual;
	}

	public void setIsVirtual(Integer isVirtual) {
		this.isVirtual = isVirtual;
	}
	
	@Column(name="is_discount")
	public Integer getIsDiscount() {
		return isDiscount;
	}

	public void setIsDiscount(Integer isDiscount) {
		this.isDiscount = isDiscount;
	}

	@Column(name="is_inventory")
	public Integer getIsInventory() {
		return isInventory;
	}

	public void setIsInventory(Integer isInventory) {
		this.isInventory = isInventory;
	}

	@Column(name="is_fullcut")
	public Integer getIsFullcut() {
		return isFullcut;
	}

	public void setIsFullcut(Integer isFullcut) {
		this.isFullcut = isFullcut;
	}

	@Column(name="is_cheap")
	public Integer getIsCheap() {
		return isCheap;
	}

	public void setIsCheap(Integer isCheap) {
		this.isCheap = isCheap;
	}

	@Column(name="limit_type")
	public Integer getLimitType() {
		return limitType;
	}

	public void setLimitType(Integer limitType) {
		this.limitType = limitType;
	}
	@Column(name = "is_purRestrictions")
	public Integer getIsPurRestrictions() {
		return isPurRestrictions;
	}

	public void setIsPurRestrictions(Integer isPurRestrictions) {
		this.isPurRestrictions = isPurRestrictions;
	}
	@Column(name = "purRestrictionsNum")
	public Integer getPurRestrictionsNum() {
		return purRestrictionsNum;
	}

	public void setPurRestrictionsNum(Integer purRestrictionsNum) {
		this.purRestrictionsNum = purRestrictionsNum;
	}
	 
	
}



